package org.pine.dictionary.util;

import org.pine.dictionary.bean.ResultVo;

/**
 * <p>
 * 结果工具类
 * </p>
 *
 * @author pine
 * @since 2024-05-16
 */
public class ResultUtil {

    public static final String SUCCESS_CODE = "0";

    public static ResultVo<Boolean> success() {
        return new ResultVo<>(Boolean.TRUE, SUCCESS_CODE, null);
    }

    public static <T> ResultVo<T> success(T data) {
        return new ResultVo<>(data, SUCCESS_CODE, null);
    }

    public static ResultVo<Boolean> error(String errorCode, String message) {
        return new ResultVo<>(Boolean.FALSE, errorCode, message);
    }
}
